<?php
/**
 * Pertyler
 * Identity Page
 *
 * @author	Emre Hasegeli <hasegeli@gmail.com>
 * @license	GNU General Public License v3
 */

namespace Pertyler;

require '../library/Pert/General/Link.php';

require '../library/Pert/General/Page.php';

require '../databaseModel/Table.php';

require '../databaseModel/Role.php';

require 'KoolControls/KoolAjax/koolajax.php';

require 'KoolControls/KoolTreeView/kooltreeview.php';

require '../control/main.php';

$treeView = new \KoolTreeView('treeView');

$treeView->imageFolder = $iconsFolder;

$treeView->styleFolder = 'default/';

$treeView->showLines = true;

$root = $treeView->getRootNode();

$link = new \Pert\Link('http://code.google.com/p/pertyler',
		'_blank');

$root->text = $link->HTML('Pertyler Database Management');

$root->expand = true;

$root->image = 'help_book.gif';

$root->showPlusMinus = false;

$link = new \Pert\Link('TableBrowser.php',
		'leftMenu');

$treeView->Add('root',
		'database',
		$link->HTML(Name),
		true,
		'ada.gif');

if($moderator = Role_Moderator::Select())
{
	$treeView->Add('database',
			'role',
			Role::Select(),
			true,
			'oMailbox.gif');

	$link = new \Pert\Link('Moderator.php',
			'body');

	$treeView->Add('role',
			'moderator',
			$link->HTML($moderator),
			false,
			'oMessage.gif');
}

echo \Pert\Page::Get()->HeaderHTML() . $treeView->Render() . \Pert\Page::Get()->FooterHTML();
